import * as echarts from 'echarts';
type EChartsOption = echarts.EChartsOption;

export default function pieOption3(myChart:echarts.ECharts){
    return {
        title: {
            text: 'Pie Chart3',
            subtext: 'Fake Data',
            left: 'center'
        },
        tooltip: {
            trigger: 'item'
        },
        series: [
            {
                name: 'Pie Chart2',
                type: 'pie',
                radius: [30, 60], 
                label: {
                    alignTo: 'edge',
                    formatter: '{name|{b}}\n{time|{c} 小时}',
                    minMargin: 5,
                    edgeDistance: 10,
                    lineHeight: 15,
                    rich: {
                        time: {
                            fontSize: 10,
                            color: '#999'
                        }
                    }
                },
                labelLine: {
                    length: 20,
                    length2: 0,
                    maxSurfaceAngle: 80
                },
                labelLayout: function (params) {
                    const isLeft = params.labelRect.x < myChart.getWidth() / 2;
                    const points = params.labelLinePoints as number[][];
                    // Update the end point.
                    points[2][0] = isLeft
                      ? params.labelRect.x
                      : params.labelRect.x + params.labelRect.width;
            
                    return {
                      labelLinePoints: points
                    };
                  },
                  top:"30",
                data: [
                    { name: '圣彼得堡来客', value: 5.6 },
                    { name: '陀思妥耶夫斯基全集', value: 1 },
                    { name: '史记精注全译（全6册）', value: 0.8 },
                    { name: '加德纳艺术通史', value: 0.5 },
                    { name: '表象与本质', value: 0.5 },
                    { name: '其它', value: 3.8 }
                ]
            }
        ]
    } as EChartsOption;
    
}
